package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * 客户端 店铺相关
 */
@RestController("userShopController")
@Slf4j
@Api( tags = "查询店铺状态接口")
@RequestMapping("/user/shop")
public class ShopController {

    @Autowired
    private RedisTemplate redisTemplate;

    public static final String key = "SHOP_STATUS";

    /**
     * 获取店铺状态
     * @return
     */
    @ApiOperation("查询店铺状态")
    @GetMapping("/status")
    public Result<Integer> queryStatus(){
        log.info("查询店铺状态");
        Integer shopStatus =(Integer) redisTemplate.opsForValue().get(key);
        return Result.success(shopStatus);
    }
}
